﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

//Author: Kha
namespace VietThuongLMS.ViewModels
{
    public class HocVien_LopViewModel
    {
        public List<HocVien_Lop> List { get; set; }
        public int Total { get; set; }
        public List<HocVien_LopMoRongModel> ListMoRong { get; set; }
        public int TotalMoRong { get; set; }

        public HocVien_LopViewModel()
        {
            this.List = new List<HocVien_Lop>();
            this.Total = 0;
            this.ListMoRong = new List<HocVien_LopMoRongModel>();
            this.TotalMoRong = 0;

        }

        public HocVien_LopViewModel(List<HocVien_Lop> list, int total)
        {
            this.List = list;
            this.Total = total;
        }

        public HocVien_LopViewModel(List<HocVien_LopMoRongModel> list, int total)
        {
            ListMoRong = list;
            TotalMoRong = total;
        }
    }

    public class HocVien_LopMoRongModel
    {
        public HocVien_Lop HV_L { get; set; }
        public string TenLopHoc { get; set; }
        public string TenLoaiLopHoc { get; set; }
        public string MonHoc { get; set; }
        public string HoTen { get; set; }
        public string DienThoai { get; set; }
        public string ChuyenDe { get; set; }
        public string DiaChi { get; set; }       
        public DateTime NgayBatDauGiamGia { get; set; }
        public DateTime NgayKetThucGiamGia { get; set; }
        public string MucHocPhi { get; set; }
        public string PhaiDong { get; set; }
        public int GiamGia { get; set; }
        public int TinhTrang { get; set; }
        public string ThanhToan { get; set; }
        public int HocVienCu { get; set; }
        public string TenChiNhanh { get; set; }
        public string NgonNgu { get; set; }
        public HocVien_LopMoRongModel()
        {
            HV_L = new HocVien_Lop();
            TenLopHoc = "";
            TenLoaiLopHoc = "";
            MonHoc = "";
            HoTen = "";
            DienThoai = "";
            ChuyenDe = "";
            DiaChi = "";
            TinhTrang = -1;
            ThanhToan = "";
            GiamGia = 0;
            HocVienCu = 0;
            NgayBatDauGiamGia = DateTime.Now;
            NgayKetThucGiamGia = DateTime.Now;
            MucHocPhi = "";
            PhaiDong = "";
            TenChiNhanh = "";
            NgonNgu = "";
        }
        public void TinhHocPhiPhaiDong()
        {
            if (HV_L.DongHocPhi == 0)
            {
                float sum = float.Parse(MucHocPhi);
                if ((GiamGia != 0) && (HV_L.NgayDangKy >= NgayBatDauGiamGia) && (HV_L.NgayDangKy <= NgayKetThucGiamGia))
                    sum = (100 - GiamGia) * sum / 100;
                if (HocVienCu != 0)
                    sum = (100 - HocVienCu) * sum / 100;
                PhaiDong = sum.ToString();
            }
        }
    }

}
